<script lang="ts" setup>
import { REGEX_HTTP_URL } from '@/views/settlement/types/validate'
import type { PropType } from 'vue'

defineProps({
  remark: { type: Object as PropType<Record<string, any>>, required: true },
})
</script>

<template>
  <el-descriptions v-show="Object.keys(remark).length > 0" :column="1" size="small">
    <template v-for="(val, key, index) in remark">
      <el-descriptions-item v-if="!['newOrderNotify', 'remark'].includes(key)" :key="index" :label="key">
        <el-image v-if="REGEX_HTTP_URL(val)" :preview-src-list="[val]" :src="val" fit="cover" style="width: 40px; height: 40px" />
        <span v-else> {{ val }}</span>
      </el-descriptions-item>
    </template>
  </el-descriptions>
</template>

<style lang="scss" scoped>
:deep(.el-descriptions__body) {
  background-color: transparent;
}
</style>
